﻿/*******************************************************************************
 * Copyright © 2016 李华丽 版权所有
 * Author: 李华丽
 * Description: 李华丽-快速开发平台
 * Website：http://www.cnblogs.com/lihuali
*********************************************************************************/
using log4net;
using System;
using System.IO;
using System.Web;

namespace Dotnet.Code
{
    public class LogFactory
    {
        static LogFactory()
        {
            string log4netConfig = $"{Environment.CurrentDirectory}\\Configs\\log4net.config";
            if (!System.IO.File.Exists(log4netConfig))
            {
                throw new Exception($"{log4netConfig}文件不存在");
            }
            FileInfo configFile = new FileInfo(log4netConfig);
            log4net.Config.XmlConfigurator.Configure(configFile);
        }
        public static Log GetLogger(Type type)
        {
            return new Log(LogManager.GetLogger(type));
        }
        public static Log GetLogger(string str)
        {
            return new Log(LogManager.GetLogger(str));
        }
    }
}
